#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

infile=open("D:/data/tb_dds_journal.txt","r")
outfile1=open("D:/data/tb_dds_journal.2.txt","w")
outfile2=open("D:/data/tb_dds_journal.more.txt","w")

infile.readline()
current_id=""
count=0
current_lines=""
for line in infile:
    line=line.rstrip()
    id=line.split("\t")[10]
    if not id==current_id:
        if count==2:
            outfile1.write(current_lines)
            outfile1.flush()
        elif count>2:
            outfile2.write(current_lines)
            outfile2.flush()
        current_lines=line+"\n"
        count=1
        current_id=id
    else:
        count+=1
        current_lines+=line+"\n"
infile.close()
if count==2:
    outfile1.write(current_lines)
    outfile1.flush()
elif count>2:
    outfile2.write(current_lines)
    outfile2.flush()
outfile1.close()
outfile2.close()

